package com.naruto.www.controller;

import com.naruto.www.domain.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class MyController {

    @GetMapping("/getUserInfo/{id}")
    public Object getUserInfo(@PathVariable("id") String userId) {
        User user = new User(userId, "jojo");
        return user;
    }

    @GetMapping("/list")
    public Object list() {
        List<User> userList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            User user = new User();
            user.setName("user" + i);
            userList.add(user);
        }
        return userList;
    }

}
